package com.wangzha.common.util;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

public class DateUtils {

    public Date localDateTimeToDate(LocalDateTime dateTime) {
        LocalDateTime now = LocalDateTime.now();
        ZoneId zoneId = ZoneId.systemDefault();
        Instant instant = now.atZone(zoneId).toInstant();

        return Date.from(now.atZone(zoneId).toInstant());
    }

    public static void main(String[] args) {

        LocalDateTime now = LocalDateTime.now();
        ZoneId zoneId = ZoneId.systemDefault();
        Instant instant = now.atZone(zoneId).toInstant();

        Date date =  Date.from(now.atZone(zoneId).toInstant());
        System.out.println("now=" + now);
        System.out.println(date);

    }


}
